<?php

namespace app\common\model;

use think\Model;

class AgentPayLog extends Model
{
    // 关联玩家
    public function user()
    {
        return $this->belongsTo('User','uid','uid')->field('uid,name,tel');
    }
    // 关联代理
    public function agent()
    {
        return $this->belongsTo('User','agent_uid','uid')->field('uid,name,tel');
    }

    /**
     * 获取充值记录
     *
     * @param [type] $map
     * @param [type] $size
     * @return void
     */
    public function getList($map, $size = null)
    {
        $list = $this->with('user,agent')->where($map)->order('create_time DESC')->paginate($size);

        return $list;
    }   

    /**
     * 添加充值记录
     *
     * @param [type] $data
     * @return void
     */
    public function addInfo($data)
    {
        return $this->save($data);
    }

}
